from zentao_test.base.base_operation import PageTools
import time

class login(PageTools):
    login_url = f'http://192.168.0.125:7007/www/index.php?m=user&f=login&referer=L3d3dy9pbmRleC5waHA='
    username_ele = '[id="account"]'
    password_ele = '[name="password"]'
    button_ele = '[id="submit"]'
    success_ele = 'a[data-toggle="dropdown"]'
    def login_action(self, username, password):
        self.visit(self.login_url)
        time.sleep(1)
        self.by_css(self.username_ele).send_keys(username)
        self.by_css(self.password_ele).send_keys(password)
        time.sleep(1)
        self.by_css(self.button_ele).click()
        time.sleep(2)
    def get_success_text(self):
        return self.by_css(self.success_ele).text